﻿using System;
using System.ComponentModel;
using Journal.Domain.Models;
using Journal.Front.Presentation.Attributes;

namespace Journal.Front.Presentation.Models.UserModels
{
    public class UserEditModel
    {
        public UserEditModel()
        {
        }

        public UserEditModel(User user)
        {
            Id = user.Id;
            Login = user.Login;
            Password = user.Password;
            Email = user.Email;
            Surname = user.UserInfo.Surname;
            Name = user.UserInfo.Name;
            GenderId = (int)user.UserInfo.Gender;
            DateBirth = user.UserInfo.DateBirth;
            FullName = string.Concat(Surname, " ", Name);
            Additionally = user.UserInfo.Additionally;
            Phone = user.UserInfo.Phone;
        }

        public int Id { get; set; }

        [DisplayName("Login")]
        public string Login { get; set; }

        [DisplayName("Password")]
        public string Password { get; set; }

        [DisplayName("Email")]
        [CustomRequiredString]
        public string Email { get; set; }

        [DisplayName("Surname")]
        public string Surname { get; set; }

        [DisplayName("Names")]
        public string Name { get; set; }

        [DisplayName("GenderId")]
        public int GenderId { get; set; }

        [DisplayName("DateBirth")]
        public DateTime DateBirth { get; set; }

        public string FullName { get; set; }

        [DisplayName("Additionally")]
        public string Additionally { get; set; }

        [DisplayName("Phone")]
        public string Phone { get; set; }
    }
}